﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OrgPersTree_Bottom.aspx.cs"
    Inherits="SysManage_OrgPersTree_Bottom" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>人员管理</title>
    <link type="text/css" rel="stylesheet" href="../css/css.css" />

    <script language="javascript" type="text/javascript">
        var stype;
        function btnMageClk(type) {//debugger;
            stype = type;
            if (typeof (parent.CenterFrame.hidform) == 'undefined') {
                alert('请选择组织！');
                return;
            }
            if (typeof (parent.RightFrame.form1) == 'undefined') {
                alert('请选择部门！');
                return;
            }
            var sobj = parent.CenterFrame.hidform.hOrgInfo.value;  //组织信息
            var sobj2 = parent.RightFrame.form1.Hobj.value;      //人员信息
            var sHOrgType = parent.RightFrame.form1.HOrgType.value;      //组织类别
            form1.Hcode.value = sobj;
            form1.HPCode.value = sobj2;
            var sobjAry = sobj.split(',');
            //alert(form1.HPCode.value);
            var sFeatures = "dialogHeight:460px;dialogWidth:600px;resizeable:no;help:no;status:no";
            //type:1-增加；2-修改；3-删除；4-查看；5-显示删除；6-隐藏删除；7-导出；8-恢复已经删除的数据
            switch (type) {
                case 1: //增加
                    if ("" == sobj) {
                        alert("请选择部门后再增加人员");
                        return;
                    }
                    showModalDialog("OrgPersTree_Pers_Edit.aspx?OrgType=" + sHOrgType, window, sFeatures);
                    //刷新GridVie
                    var btnRefresh = parent.RightFrame.document.getElementById("BtnRefresh");
                    if (btnRefresh != null)
                        btnRefresh.click();
                    break;
                case 2: //修改
                    if ("" == sobj2) {
                        alert("请选择要修改的人员信息");
                        return;
                    }
                    showModalDialog("OrgPersTree_Pers_Edit.aspx?OrgType=" + sHOrgType, window, sFeatures);
                    //刷新GridView
                    var btnRefresh = parent.RightFrame.document.getElementById("BtnRefresh");
                    if (btnRefresh != null)
                        btnRefresh.click();
                    break;
                case 9: //引用
                    if ("" == sobj) {
                        alert("请选择部门后再引用人员");
                        return;
                    }
                    showModalDialog("OrgPersTree_Pers_Relation.aspx?OrgType=" + sHOrgType + "&DeptID=" + sobjAry[0], window, sFeatures);
                    //刷新GridVie
                    var btnRefresh = parent.RightFrame.document.getElementById("BtnRefresh");
                    if (btnRefresh != null)
                        btnRefresh.click();
                    break;
                case 10: //发布
                    if ("" == sobj) {
                        alert("请选择部门后再点击发布按钮");
                        return;
                    }
                    var btnRefresh = parent.RightFrame.document.getElementById("BtnFB");
                    if (btnRefresh != null)
                        btnRefresh.click();
                    break;

                case 3: //删除
                    if ("" == sobj2) {
                        alert("请选择要删除的人员记录");
                        return;
                    }
                    if (confirm("真的要删除该条记录？")) {
                        var ifrmDel = parent.RightFrame.document.getElementById("BtnDel");
                        if (ifrmDel != null) {
                            ifrmDel.click();
                        }
                    }
                    else {
                        var btnRefresh = parent.RightFrame.document.getElementById("BtnRefresh");
                        if (btnRefresh != null)
                            btnRefresh.click();
                    }
                    break;
                case 4: //查看 
                    if ("" == sobj2) {
                        alert("请选择人员信息后再查看");
                        return;
                    }
                    showModalDialog("OrgPersTree_View.aspx", window, sFeatures);
                    //                    var btnRefresh=parent.RightFrame.document.getElementById("BtnRefresh");
                    //				    if(btnRefresh!=null)
                    //				        btnRefresh.click();
                    break;
                case 5: //显示删除      
                    //按钮处理      
                    window.document.all.btn_hide_del.style.display = "inline";
                    window.document.all.btn_disp_del.style.display = "none";
                    window.document.all.btn_resume.style.display = "inline";
                    window.document.all.btn_export.style.display = "none";
                    //操作按钮处理				    				    
                    window.document.all.btn_new_pd.disabled = true;
                    window.document.all.btn_hf_Mod.disabled = true;
                    window.document.all.btn_hf_Rela.disabled = true;
                    //window.document.all.btn_hf_view.disabled=true;
                    window.document.all.btn_hf_del.disabled = true;
                    //window.document.all.btn_export.disabled=true;
                    //显示删除
                    var vDel = parent.RightFrame.document.getElementById("BtnDispDel");
                    if (vDel != null) vDel.click();
                    break;
                case 6: //隐藏删除
                    //本身删除变化按钮处理  
                    window.document.all.btn_disp_del.style.display = "inline";
                    window.document.all.btn_hide_del.style.display = "none";
                    window.document.all.btn_export.style.display = "inline";
                    window.document.all.btn_resume.style.display = "none";
                    //操作按钮处理				    				    
                    window.document.all.btn_new_pd.disabled = false;
                    window.document.all.btn_hf_Mod.disabled = false;
                    window.document.all.btn_hf_Rela.disabled = false;
                    //window.document.all.btn_hf_view.disabled=false;
                    window.document.all.btn_hf_del.disabled = false;
                    //window.document.all.btn_export.disabled=false;
                    //显示删除
                    var vDel = parent.RightFrame.document.getElementById("BtnHideDel");
                    if (vDel != null) vDel.click();
                    break;
                case 7: //导出
                    var ifrm = parent.RightFrame.document.getElementById("BtnExport");
                    if (ifrm != null) ifrm.click();
                    break;
                case 8: //恢复已经删除的数据
                    if ("" == sobj2) {
                        alert("请选择一条记录进行恢复");
                        return;
                    }
                    var d8 = sobj2.split('|');
                    if ("1" == d8[11]) {
                        alert("该行数据已经存在，不需要恢复");
                        return;
                    }
                    var ifrm = parent.RightFrame.document.getElementById("BtnResume");
                    if (ifrm != null) ifrm.click();
                    break;
                case 99: //删除
                    if ("" == sobj) {
                        alert("请选择要永久删除的记录");
                        return;
                    }
                    if (confirm("真的要永久删除该条记录？")) {
                        var ifrmDel = parent.RightFrame.document.getElementById("BtnYJDel");
                        if (ifrmDel != null) {
                            ifrmDel.click();
                        }
                    }
                    else {
                        var btnRefresh = parent.RightFrame.document.getElementById("BtnRefresh");
                        if (btnRefresh != null)
                            btnRefresh.click();
                    }
                    break;
            }

            //if( 4 != type )
            //{//查看 不需要清空
            //清空已经选择的值
            // district.form1.Hobj.value ="";
            //}
        }
    </script>

</head>
<body style="background-image: url('../images/hit_bg.gif');">
    <form id="form1" runat="server">
    <table style="width: 100%;" align="center" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td align="center">
                <input name="btn_new_pd" id="btn_new_pd" type="button" class="button03" onclick="btnMageClk(1)"
                    value="增加(A)" accesskey="a" runat="server" />
                <input name="btn_hf_Mod" id="btn_hf_Mod" type="button" class="button03" onclick="btnMageClk(2)"
                    value="修改(E)" accesskey="e" />
                <input name="btn_hf_Rela" id="btn_hf_Rela" type="button" class="button03" onclick="btnMageClk(9)"
                    value="引用(B)" accesskey="b" />
                <input name="btn_hf_del" id="btn_hf_del" type="button" class="button03" onclick="btnMageClk(3)"
                    value="删除(D)" accesskey="d" />
                <input name="btn_view" id="btn_view" type="button" class="button03" onclick="btnMageClk(4)"
                    value="查看(V)" accesskey="v" />
                <input name="btn_disp_del" id="btn_disp_del" type="button" class="button05" onclick="btnMageClk(5)"
                    value="显示删除(G)" accesskey="g" style="display: inline;" />
                <input name="btn_hide_del" id="btn_hide_del" type="button" class="button05" onclick="btnMageClk(6)"
                    value="隐藏删除(H)" accesskey="h" style="display: none;" />
                <input name="btn_del" id="btn_del" type="button" class="button05" onclick="btnMageClk(99)"
                    value="永久删除(Y)" accesskey="y" style="display: inline;" />
                <input name="btn_export" id="btn_export" type="button" class="button03" onclick="btnMageClk(10)"
                    value="发布(P)" accesskey="p" style="display: inline;" />
                <input name="btn_resume" id="btn_resume" type="button" class="button03" onclick="btnMageClk(8)"
                    value="恢复(R)" accesskey="r" style="display: none;" />
            </td>
        </tr>
    </table>
    <input id="Hcode" runat="server" type="hidden" />
    <input id="HPCode" runat="server" type="hidden" />
    </form>
</body>
</html>
